package com.china08.yxyapi.api.home.kecheng.xiaoben;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang3.StringUtils;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.china08.yxyapi.api.YxyApiBaseController;
import com.china08.yxyapi.api.home.kecheng.xiaoben.KechengXiaobenContainingSrhController.ReqModel;
import com.china08.yxyapi.model.YxyApiRespModel;

/**
 * 校本课程--判断是否关联学校
 * 
 * @author LiuWeidong
 *
 */
@CrossOrigin
@RestController
public class KechengXiaobenRoleSchoolController extends YxyApiBaseController {

    @RequestMapping(value = "/api_yw/home/kecheng/xiaoben/role/school", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public RespModel find(HttpServletRequest request, HttpServletResponse response,
            @RequestBody(required = false) ReqModel reqModel) {

        RespModel model = new RespModel();
        String role = getProfile(request, response).getRoleId();
        if (StringUtils.isNotBlank(role)) {
            model.roleSchool = true;
        } else {
            model.roleSchool = false;
        }
        return model;
    }

    /* 响应参数 */
    protected static class RespModel extends YxyApiRespModel {

        // 是否关联学校
        public Boolean roleSchool;
    }

}
